using System.Collections.Generic;
using Kopernikus.Parsing.GenericParsing;
using NUnit.Framework;
using Kopernikus.Parsing.GenericLexing;
using Kopernikus.Parsing.Lexing;
namespace Kopernikus.Parsing.Tests.GenericParsing
{
    [TestFixture]
    public class TestTypeInference
    {
        private class P1
        {
            [Lex("e","\\d+")]
            static int t_e(LexerMatch m)
            {
                return 0;
            }

            [LexDefault(LexDefaultAttributeOptions.AnySingleCharacter)]
            static object t_default(LexerMatch m)
            {
                return m.Value;
            }


            [CfgStart("P -> L")]
            static List<object> p_P(List<object> l)
            {
                return l;
            }

            [Cfg("L -> e.0")]
            static List<object> p_L(int e)
            {
                return new List<object>(new object[]{e});
            }

            [Cfg("L -> L.0 , e.1")]
            static List<object> p_L(List<object> l, int e)
            {
                l.Add(e);
                return l;
            }
        }

        [Test]
        public void Test_ModelIsObjectButLiteralsAreInts()
        {
            GenericParser<P1, object> parser = GenericParser<P1, object>.Create(new P1());
        }
    }
}
